package com.yancy.util;

import com.yancy.entity.Teacher;

import java.util.List;
import java.util.Optional;

/**
 * @description:
 * @author: YancyZhang
 * @time: 2021/12/3 9:37
 */

public class GetTeacherUtils {
    //返回总教师列表
    public List<Teacher> getTeacherList(){
        TeacherList list = new TeacherList();
        return list.getTeacherList();
    }
    /*根据id查询指定教师*/
    public Optional<Teacher> getTeacher(int id){
        List<Teacher> list = getTeacherList();
        return list.stream()
                .filter(item->item.getId() == id)
                .findFirst();
    }

}